//函数作为参数

// forEach 遍历数组
function forEach (array, fn) {
	for (let i = 0; i < array.length; i++){
		fn(array[i]);
	}
}

//filter  过滤器
function filter (array, fn) {
    let result = [];
    for(let i = 0; i < array.length; i++){
        if(fn(array[i])){
            result.push(array[i]);
        }
    }
    return result;
}